<html>
	<head>
		<title>JS学习</title>
		<meta http-equiv="Content-Type content=text/html" charset="utf-8">
		<script>
			
			var a = 0;
			while (a <= 100) {
				if (a % 2 == 0) {
					document.write( a + '是偶数');
				}
				document.write("<br />");
				a++;
			}
			
			function startTime(){
				var today=new Date()
				var h=today.getHours()
				var m=today.getMinutes()
				var s=today.getSeconds()
				// add a zero in front of numbers<10
				m=checkTime(m)
				s=checkTime(s)
				document.getElementById('txt').innerHTML=h+":"+m+":"+s
				t=setTimeout('startTime()',500)
			}
				
			function checkTime(i) {
				if (i<10) 
				{i="0" + i}
				return i
			}
		</script>
	</head>
	<body onload="startTime()"> 
	<!-- //页面加载时调用startTime函数 -->
		<div id="txt"></div>
		<!-- //用来显示时间的标签 -->
	</body>
	
	
</html>